package com.bobi.tfca.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author 李文发
 * @date 2024/4/20
 */
@AllArgsConstructor
@Getter
public enum AuditStatusEnum {

    /**
     * 未审核
     */
    NOT_AUDITED(0, "未审核"),
    /**
     * 通过
     */
    PASS(2, "通过"),
    /**
     * 拒绝
     */
    REJECT(1, "拒绝");

    private final Integer code;
    private final String desc;

    public static AuditStatusEnum getStatusByCode(Integer code) {
        for (AuditStatusEnum value : AuditStatusEnum.values()) {
            if (Objects.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }

    public static AuditStatusEnum getStatusByDesc(String desc) {
        for (AuditStatusEnum value : AuditStatusEnum.values()) {
            if (Objects.equals(value.getDesc(), desc)) {
                return value;
            }
        }
        return null;
    }
}
